VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} frmEntryBox 
   Caption         =   "Lookup Value"
   ClientHeight    =   4920
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   9060
   OleObjectBlob   =   "frmEntryBox.frx":0000
   StartUpPosition =   1  'CenterOwner
End
Attribute VB_Name = "frmEntryBox"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


'---------------------------------------------------------------------------------------
' Module    : frmEntryBox
' DateTime  : 12/14/2006
' Purpose   :
'---------------------------------------------------------------------------------------
'
Private m_blnDisableEvents As Boolean
Private boolInitialized As Boolean
Option Explicit



Private Sub checkDocs_Click()

    If boolInitialized Then
        m_objReg.SaveValue "ArrayProject", "checkDocs", checkDocs.Value
    End If
    
End Sub

Private Sub checkProcess_Click()

    If boolInitialized Then
        m_objReg.SaveValue "ArrayProject", "checkProcess", checkProcess.Value
    End If
    
End Sub

Private Sub checkTD_Click()

    If boolInitialized Then
        m_objReg.SaveValue "ArrayProject", "checkTD", checkTD.Value
    End If
    
End Sub

'---------------------------------------------------------------------------------------
' Procedure : cmdOK_Click
' DateTime  : 10/11/2005
' Purpose   : Calls SetRecord to pass the text value
'---------------------------------------------------------------------------------------
'
Private Sub cmdOK_Click()

    On Error GoTo cmdOK_Click_Error
    
    Dim vbResult As VbMsgBoxResult
    Dim strDateCreated As String
    Dim strMessage As String
    
    ' Ignore click if text box is empty
    If comboOrderSource.Text & "" = "" _
    Or Trim(txtValue.Text) = "" Then
        txtValue.SetFocus
        Exit Sub
    End If
    
    ' Set UserForm Registry attributes
    Call SetRegistryAttributes
    
    ' Hide g_formentryBox
    Me.Hide
    
    'If record not found then show the messagebox
    If Not Cafe3.SetRecord(txtValue.Text, strDateCreated) Then
        vbResult = MsgBox(GetLiteral(104, txtValue.Text), vbExclamation + vbSystemModal + vbYesNo, "FXI")
        If vbResult = vbYes Then
            Call Integration.ShowEntryBox
        End If
    End If
        
    Exit Sub
    
cmdOK_Click_Error:

    MsgBox Err.Description & " (cmdOK_Click)", vbCritical + vbOKOnly + vbSystemModal
        
End Sub

'---------------------------------------------------------------------------------------
' Procedure : cmdCancel_Click
' DateTime  : 10/11/2005
' Purpose   : Cancels record process
'---------------------------------------------------------------------------------------
'
Private Sub cmdCancel_Click()

    On Error GoTo cmdCancel_Click_Error
    
    ' Set UserForm Registry attributes
    Call SetRegistryAttributes
    
    Unload g_formEntryBox
    Set g_formEntryBox = Nothing
    
    Exit Sub
    
cmdCancel_Click_Error:

    MsgBox Err.Description & " (cmdCancel_Click)", vbCritical + vbOKOnly + vbSystemModal
        
End Sub


Private Sub SetRegistryAttributes()

    On Error Resume Next
    
    ' Save last position, calendar used or not, selected date in registry
    With m_objReg
        .SaveValue "EntryBox", "Left", Me.Left
        .SaveValue "EntryBox", "Top", Me.Top
    End With
    
    Exit Sub
  
SetRegistryAttributes_Error:
    MsgBox Err.Description & " (SetRegistryAttributes)", vbSystemModal
    
End Sub

'---------------------------------------------------------------------------------------
' Procedure : DisableEvents
' DateTime  : 12/18/2006
' Purpose   : Pervent events from being raise while initializing form
'---------------------------------------------------------------------------------------
'
Public Property Let DisableEvents(ByVal blnDisableEvents As Boolean)
    m_blnDisableEvents = blnDisableEvents
End Property

Private Sub comboFreight_Change()

    If boolInitialized Then
        m_objReg.SaveValue "ArrayProject", "comboFreight", comboFreight.Value & ""
    End If
    
End Sub

Private Sub comboOrderSource_Change()

    If boolInitialized Then
        m_objReg.SaveValue "ArrayProject", "comboOrderSource", comboOrderSource.Text & ""
    End If

    Call ODBC2.DestroyConnection
    Call ODBC3.DestroyConnection
    
End Sub

Private Sub comboPackaging_Change()

    If boolInitialized Then
        m_objReg.SaveValue "ArrayProject", "comboPackaging", comboPackaging.Value & ""
    End If
    
End Sub

Private Sub comboService_Change()

    If boolInitialized Then
        m_objReg.SaveValue "ArrayProject", "comboService", comboService.Value & ""
    End If
    
End Sub

Private Sub textCmdtyDescription_Change()

    If boolInitialized Then
        m_objReg.SaveValue "ArrayProject", "textCmdtyDescription", textCmdtyDescription.Value
    End If
    
End Sub

Private Sub textCmdtyValue_Change()

    If boolInitialized Then
        m_objReg.SaveValue "ArrayProject", "textCmdtyValue", textCmdtyValue.Value
    End If
    
End Sub

Private Sub textFreightAcct_Change()

    If boolInitialized Then
        m_objReg.SaveValue "ArrayProject", "textFreightAcct", textFreightAcct.Value
    End If
    
End Sub

Private Sub textRecipientPhone_Change()

    If boolInitialized Then
        m_objReg.SaveValue "ArrayProject", "textRecipientPhone", textRecipientPhone.Value
    End If
    
End Sub

'---------------------------------------------------------------------------------------
' Procedure : UserForm Events
' DateTime  : 02/02/2006
' Purpose   :
'---------------------------------------------------------------------------------------
'
Private Sub UserForm_Activate()

    On Error GoTo UserForm_Activate_Error
    
    'This form should be topmost window
    With Window
        .SetFocus .Find(g_formEntryBox.Caption)
    End With
    
    Exit Sub
    
UserForm_Activate_Error:

    MsgBox Err.Description & " (UserForm_Activate)", vbCritical + vbOKOnly + vbSystemModal
    
End Sub

Private Sub UserForm_Initialize()

    ' Set module variables
    If m_objReg Is Nothing Then Set m_objReg = New FSIX.IRegistry
    
    comboService.AddItem "Priority Overnight"
    comboService.List(comboService.ListCount - 1, 1) = "01"
    ' comboService.AddItem "Standard Overnight"
    ' comboService.List(comboService.ListCount - 1, 1) = "03"
    comboService.AddItem "Economy 2Day"
    comboService.List(comboService.ListCount - 1, 1) = "06"
    ' Not able with FXI TD
    '    comboService.AddItem "Express Saver"
    '    comboService.List(comboService.ListCount - 1, 1) = "20"
    comboService.AddItem "Freight - 1day"
    comboService.List(comboService.ListCount - 1, 1) = "70"
    ' Not able with FXI TD
'    comboService.AddItem "Freight - 2day"
'    comboService.List(comboService.ListCount - 1, 1) = "80"
'    comboService.AddItem "Freight - 3day"
'    comboService.List(comboService.ListCount - 1, 1) = "83"
'    comboService.AddItem "Freight - Economy"
'    comboService.List(comboService.ListCount - 1, 1) = "86"
'    comboService.AddItem "Ground - Home"
'    comboService.List(comboService.ListCount - 1, 1) = "90"
    ' Not available to Hummingbird
    comboService.AddItem "Ground"
    comboService.List(comboService.ListCount - 1, 1) = "92"
    
    comboService.ListIndex = 0
    
    comboPackaging.AddItem "Customer Pack"
    comboPackaging.List(comboPackaging.ListCount - 1, 1) = "01"
    comboPackaging.AddItem "FedEx Pak"
    comboPackaging.List(comboPackaging.ListCount - 1, 1) = "02"
    comboPackaging.AddItem "FedEx Box"
    comboPackaging.List(comboPackaging.ListCount - 1, 1) = "03"
    comboPackaging.AddItem "FedEx Tube"
    comboPackaging.List(comboPackaging.ListCount - 1, 1) = "04"
    comboPackaging.AddItem "FedEx Envelope"
    comboPackaging.List(comboPackaging.ListCount - 1, 1) = "06"
    comboPackaging.AddItem "FedEx 10KG Box"
    comboPackaging.List(comboPackaging.ListCount - 1, 1) = "15"
    comboPackaging.AddItem "FedEx 25KG Box"
    comboPackaging.List(comboPackaging.ListCount - 1, 1) = "25"
    
    comboPackaging.ListIndex = 0
    
    
    comboFreight.AddItem "1 - Sender"
    comboFreight.List(comboFreight.ListCount - 1, 1) = "1"
    comboFreight.AddItem "2 - Recipient"
    comboFreight.List(comboFreight.ListCount - 1, 1) = "2"
    comboFreight.AddItem "3 - Third Party"
    comboFreight.List(comboFreight.ListCount - 1, 1) = "3"
    comboFreight.AddItem "4 - Collect"
    comboFreight.List(comboFreight.ListCount - 1, 1) = "4"
    
    comboFreight.ListIndex = 0
    
    comboOrderSource.AddItem "CotyPunchlistCA"
    comboOrderSource.AddItem "CotyPunchlistUS"
    
    
    ' Save last position, calendar used or not, selected date in registry
    With m_objReg
        checkProcess.Value = CBool(.GetValue(fsiDefault, "ArrayProject", "checkProcess"))
        checkDocs.Value = CBool(.GetValue(fsiDefault, "ArrayProject", "checkDocs"))
        checkTD.Value = CBool(.GetValue(fsiDefault, "ArrayProject", "checkTD"))
        comboFreight.Value = .GetValue(fsiDefault, "ArrayProject", "comboFreight")
        comboOrderSource.Text = .GetValue(fsiDefault, "ArrayProject", "comboOrderSource")
        comboPackaging.Value = .GetValue(fsiDefault, "ArrayProject", "comboPackaging")
        comboService.Value = .GetValue(fsiDefault, "ArrayProject", "comboService")
        If .GetValue(fsiDefault, "ArrayProject", "textCmdtyDescription") & "" <> "" Then
            textCmdtyDescription.Value = .GetValue(fsiDefault, "ArrayProject", "textCmdtyDescription")
        End If
        textCmdtyValue.Value = .GetValue(fsiDefault, "ArrayProject", "textCmdtyValue")
        textFreightAcct.Value = .GetValue(fsiDefault, "ArrayProject", "textFreightAcct")
        textRecipientPhone.Value = .GetValue(fsiDefault, "ArrayProject", "textRecipientPhone")
    End With

    boolInitialized = True

End Sub

Private Sub UserForm_Terminate()

    On Error GoTo UserForm_Terminate_Error
    
    Set m_objReg = Nothing
    Set g_formEntryBox = Nothing
    
    Exit Sub
    
UserForm_Terminate_Error:

    MsgBox Err.Description & " (UserForm_Terminate)", vbCritical + vbOKOnly + vbSystemModal
    
End Sub

